//
//  STCommentService.swift
//  Story
//
//  Created by 汤泽川 on 2019/4/24.
//  Copyright © 2019 汤泽川. All rights reserved.
//

import Foundation
class STCommentService {
    @discardableResult
    public func queryCommentInfo(replayId : Int?, storyId : Int?, page : Int, count : Int) -> STResponse<[STCommentInfo]> {
        let response = STResponse<[STCommentInfo]>()
        if replayId == nil && storyId == nil {
            response.execute([STCommentInfo](), nil)
        } else {
            STCommentApi.queryComment(replayId: replayId, storyId: storyId, page: page, count: count) { (data, error) in
                response.execute(data?.data, error)
            }
        }
        return response
    }
    @discardableResult
    public func sendComment(replayId : Int?, storyId : Int?, content : String) -> STResponse<STCommentInfo> {
        let response = STResponse<STCommentInfo>()
        STCommentApi.sendComment(replayId: replayId, storyId: storyId, content: content) { (data, error) in
            response.execute(data?.data, error)
        }
        return response
    }
}
